﻿<%@ Page EnableEventValidation="true" Title="" Language="C#" MasterPageFile="~/Admin/AdminMasterPage.Master" AutoEventWireup="true" CodeFile="ChiTietLoaiSanPham.aspx.cs" Inherits="Admin_CapNhatLoaiSanPham" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


<h3>Chi tiết loại tài liệu</h3>
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="IDLoaiTL" DataSourceID="SqlDataSource1" 
        EnableModelValidation="True">
    
     <EditItemTemplate>
        <table class="table_ct_loai_sp">
        <tr>
            <td class="trai ten">Mã loại:</td>
            <td class="ten"><asp:Label ID="IDLoaiTLLabel1" runat="server" Text='<%# Eval("IDLoaiTL") %>' /></td>
        </tr>
          <tr>
            <td class="trai">Tên loại (tiếng Việt):</td>
            <td><asp:TextBox ID="TenLoaiTLTextBox" runat="server" 
                Text='<%# Bind("TenLoaiTL") %>' /></td>
                </tr> 
                <tr>
            <td class="trai">Tên loại (tiếng Anh):</td>
            <td> <asp:TextBox ID="TenLoaiTL_enTextBox" runat="server" 
                Text='<%# Bind("TenLoaiTL_en") %>' /></td>
                </tr>
                 <tr>
            <td class="trai">Thuộc về:</td>
          <td>
            <asp:DropDownList ID="ddlLoaiTLCha" runat="server" AppendDataBoundItems="true"
               DataSourceID="SqlDataSource2"
               DataTextField="TenLoaiTL"
               DataValueField="IDLoaiTL" selectedvalue='<%# Bind("IDLoaiTLCha") %>'
            >
            <asp:ListItem Value="0" Text="--Không có--"></asp:ListItem>
            </asp:DropDownList></td>
            </tr>

            <tr>
            <td class="trai">Thứ tự hiển thị:</td>
            <td>
            <asp:TextBox ID="ThuTuHienThiTextBox" runat="server" 
                Text='<%# Bind("ThuTuHienThi") %>' /></td>
              </tr>
              <tr>
            <td class="trai">Loại Copy:</td>
         
            <td>
           <asp:DropDownList ID="ddlLoaiCopy" runat="server" selectedvalue='<%# Bind("LoaiCopy")%>'>
            <asp:ListItem Value="1" Text="Hard-Copy"></asp:ListItem>
            <asp:ListItem Value="0" Text="Soft-Copy"></asp:ListItem>
            </asp:DropDownList></td>
            </tr>        
            <tr>
            <td colspan="2" class="td_chitiet_sp" align="center">
  
         <asp:Button ID="UpdateButton" runat="server" CommandName="Update" CssClass="button"
                Text="Cập nhật" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" CssClass="button"
                Text="Bỏ qua" />
                </td>
                </tr>
            </table>
        </EditItemTemplate>
    

        <EmptyDataTemplate>
            <span>No data was returned.</span>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <span style="">TenLoaiTL:
            <asp:TextBox ID="TenLoaiTLTextBox" runat="server" 
                Text='<%# Bind("TenLoaiTL") %>' />
            <br />TenLoaiTL_en:
            <asp:TextBox ID="TenLoaiTL_enTextBox" runat="server" 
                Text='<%# Bind("TenLoaiTL_en") %>' />
            <br />IDLoaiTLCha:
            <asp:TextBox ID="IDLoaiTLChaTextBox" runat="server" 
                Text='<%# Bind("IDLoaiTLCha") %>' />
            <br />ThuTuHienThi:
            <asp:TextBox ID="ThuTuHienThiTextBox" runat="server" 
                Text='<%# Bind("ThuTuHienThi") %>' />
            <br />LoaiCopy:
            <asp:TextBox ID="LoaiCopyTextBox" runat="server" 
                Text='<%# Bind("LoaiCopy") %>' />
            <br />
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                Text="Insert" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Clear" />
            <br /><br /></span>
        </InsertItemTemplate>
     
        <ItemTemplate>
        <table class="table_ct_loai_sp">
        <tr>
            <td class="trai ten">Mã loại:</td>
            <td class="ten"><asp:Label ID="IDLoaiTLLabel" runat="server" Text='<%# Eval("IDLoaiTL") %>' /></td>
        </tr>
          <tr>
            <td class="trai">Tên loại (tiếng Việt):</td>
            <td><asp:Label ID="TenLoaiTLLabel" runat="server" Text='<%# Eval("TenLoaiTL") %>' /></td>
                </tr> 
                <tr>
            <td class="trai">Tên loại (tiếng Anh):</td>
            <td><asp:Label ID="TenLoaiTL_enLabel" runat="server" 
                Text='<%# Eval("TenLoaiTL_en") %>' /></td>
                </tr>
                 <tr>
            <td class="trai">Thuộc về:</td>
          <td>
           <asp:Label ID="IDLoaiTLChaLabel" runat="server"
                Text='<%# Eval("TenLoaiTLCha") %>' /></td>
            </tr>

            <tr>
            <td class="trai">Thứ tự hiển thị:</td>
            <td>
            <asp:Label ID="ThuTuHienThiLabel" runat="server" 
                Text='<%# Eval("ThuTuHienThi") %>' /></td>
              </tr>
              <tr>
            <td class="trai">Loại Copy:</td>
         
            <td>
           <asp:Label ID="LoaiCopyLabel" runat="server" Text='<%# format_text(Eval("LoaiCopy").ToString()) %>' /> </td>
            </tr>        
            <tr>
            <td colspan="2" class="td_chitiet_sp" align="center">
  
           <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Chỉnh sửa" CssClass="button" />
            <asp:Button ID="LinkButton1" runat="server" CssClass="button" PostBackUrl="~/Admin/QuanLyLoaiSanPham.aspx" Text="Quay về danh sách"></asp:Button>

                </td>
                </tr>
            </table>
        </ItemTemplate>
        <LayoutTemplate>
            <div ID="itemPlaceholderContainer" runat="server" style="">
                <span runat="server" id="itemPlaceholder" />
            </div>
            <div style="">
            </div>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <span style="">IDLoaiTL:
            <asp:Label ID="IDLoaiTLLabel" runat="server" Text='<%# Eval("IDLoaiTL") %>' />
            <br />
            TenLoaiTL:
            <asp:Label ID="TenLoaiTLLabel" runat="server" Text='<%# Eval("TenLoaiTL") %>' />
            <br />
            TenLoaiTL_en:
            <asp:Label ID="TenLoaiTL_enLabel" runat="server" 
                Text='<%# Eval("TenLoaiTL_en") %>' />
            <br />
            IDLoaiTLCha:
            <asp:Label ID="IDLoaiTLChaLabel" runat="server" 
                Text='<%# Eval("IDLoaiTLCha") %>' />
            <br />
            ThuTuHienThi:
            <asp:Label ID="ThuTuHienThiLabel" runat="server" 
                Text='<%# Eval("ThuTuHienThi") %>' />
            <br />
            LoaiCopy:
            <asp:Label ID="LoaiCopyLabel" runat="server" Text='<%# Eval("LoaiCopy") %>' />
            <br />
            <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br /><br /></span>
        </SelectedItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:ConnectionStringMembership %>" 
        DeleteCommand="DELETE FROM [LoaiTaiLieu] WHERE [IDLoaiTL] = @original_IDLoaiTL AND (([TenLoaiTL] = @original_TenLoaiTL) OR ([TenLoaiTL] IS NULL AND @original_TenLoaiTL IS NULL)) AND (([TenLoaiTL_en] = @original_TenLoaiTL_en) OR ([TenLoaiTL_en] IS NULL AND @original_TenLoaiTL_en IS NULL)) AND (([IDLoaiTLCha] = @original_IDLoaiTLCha) OR ([IDLoaiTLCha] IS NULL AND @original_IDLoaiTLCha IS NULL)) AND (([ThuTuHienThi] = @original_ThuTuHienThi) OR ([ThuTuHienThi] IS NULL AND @original_ThuTuHienThi IS NULL)) AND (([LoaiCopy] = @original_LoaiCopy) OR ([LoaiCopy] IS NULL AND @original_LoaiCopy IS NULL))" 
        InsertCommand="INSERT INTO [LoaiTaiLieu] ([TenLoaiTL], [TenLoaiTL_en], [IDLoaiTLCha], [ThuTuHienThi], [LoaiCopy]) VALUES (@TenLoaiTL, @TenLoaiTL_en, @IDLoaiTLCha, @ThuTuHienThi, @LoaiCopy)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT *,(SELECT b2.[TenLoaiTL] FROM [LoaiTaiLieu] b2 WHERE b2.[IDLoaiTL] = b1.[IDLoaiTLCha]) as TenLoaiTLCha FROM [LoaiTaiLieu] b1 " 
        UpdateCommand="UPDATE [LoaiTaiLieu] SET [TenLoaiTL] = @TenLoaiTL, [TenLoaiTL_en] = @TenLoaiTL_en, [IDLoaiTLCha] = @IDLoaiTLCha, [ThuTuHienThi] = @ThuTuHienThi, [LoaiCopy] = @LoaiCopy WHERE [IDLoaiTL] = @original_IDLoaiTL AND (([TenLoaiTL] = @original_TenLoaiTL) OR ([TenLoaiTL] IS NULL AND @original_TenLoaiTL IS NULL)) AND (([TenLoaiTL_en] = @original_TenLoaiTL_en) OR ([TenLoaiTL_en] IS NULL AND @original_TenLoaiTL_en IS NULL)) AND (([IDLoaiTLCha] = @original_IDLoaiTLCha) OR ([IDLoaiTLCha] IS NULL AND @original_IDLoaiTLCha IS NULL)) AND (([ThuTuHienThi] = @original_ThuTuHienThi) OR ([ThuTuHienThi] IS NULL AND @original_ThuTuHienThi IS NULL)) AND (([LoaiCopy] = @original_LoaiCopy) OR ([LoaiCopy] IS NULL AND @original_LoaiCopy IS NULL))">
          
        <DeleteParameters>
            <asp:Parameter Name="original_IDLoaiTL" Type="Int32" />
            <asp:Parameter Name="original_TenLoaiTL" Type="String" />
            <asp:Parameter Name="original_TenLoaiTL_en" Type="String" />
            <asp:Parameter Name="original_IDLoaiTLCha" Type="Int32" />
            <asp:Parameter Name="original_ThuTuHienThi" Type="Int32" />
            <asp:Parameter Name="original_LoaiCopy" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="TenLoaiTL" Type="String" />
            <asp:Parameter Name="TenLoaiTL_en" Type="String" />
            <asp:Parameter Name="IDLoaiTLCha" Type="Int32" />
            <asp:Parameter Name="ThuTuHienThi" Type="Int32" />
            <asp:Parameter Name="LoaiCopy" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="TenLoaiTL" Type="String" />
            <asp:Parameter Name="TenLoaiTL_en" Type="String" />
            <asp:Parameter Name="IDLoaiTLCha" Type="Int32" />
            <asp:Parameter Name="ThuTuHienThi" Type="Int32" />
            <asp:Parameter Name="LoaiCopy" Type="Int32" />
            <asp:Parameter Name="original_IDLoaiTL" Type="Int32" />
            <asp:Parameter Name="original_TenLoaiTL" Type="String" />
            <asp:Parameter Name="original_TenLoaiTL_en" Type="String" />
            <asp:Parameter Name="original_IDLoaiTLCha" Type="Int32" />
            <asp:Parameter Name="original_ThuTuHienThi" Type="Int32" />
            <asp:Parameter Name="original_LoaiCopy" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionStringMembership %>" 
        SelectCommand="SELECT [IDLoaiTL],[TenLoaiTL] FROM [LoaiTaiLieu]"></asp:SqlDataSource>
</asp:Content>

